package com.lanqiao.javaparkinglot.controller;

import com.lanqiao.javaparkinglot.common.CommonResult;
import com.lanqiao.javaparkinglot.entity.Hwhs;
import com.lanqiao.javaparkinglot.service.HwhsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/huowuhs")
public class HwhsController {
    @Autowired
    HwhsService hwhsService;
    //查询
    @GetMapping("/cha")
    public CommonResult findhwhs (Hwhs hwhs){
        List<Hwhs> hwhsList=hwhsService.findhwhs();
        return CommonResult.success("货物核酸表查询",hwhsList);

    }
    //添加
    @PostMapping("/tianjia")
    public CommonResult addhwhs(@RequestBody Hwhs hwhs){
        hwhsService.addhwhs(hwhs);
        return CommonResult.success("货物核算表添加成功");
    }
    //修改
    @PutMapping("/xiugai")
    public CommonResult updetehwhs (@RequestBody Hwhs hwhs){
        hwhsService.updatehwhs(hwhs);
        return CommonResult.success("货物核算表信息查询成功");
    }
    //删除
    @DeleteMapping("/{hsh_id}")
    public CommonResult deletehwhs(@PathVariable("hsh_id") Long hsh_id){
        hwhsService.deletehwhs(hsh_id);
        return CommonResult.success("数据删除成功");
    }
}
